package com.gooluke.mall.common.dto;

import com.gooluke.mall.common.enums.BaseErrorStatus;

/**
 * @author gooluke
 */
public class BaseResponseDTO extends BaseDTO{

    private String code = "0";
    private String msg = "success";
    private String bizSeqNo;
    private PageInfo page;
    private Object data;

    public BaseResponseDTO() {
    }

    public static BaseResponseDTO success(Object object, PageInfo page) {
        BaseResponseDTO baseResponseDTO = new BaseResponseDTO();
        if (object instanceof BaseResponseDTO) {
            ((BaseResponseDTO)object).setCode((String)null);
            ((BaseResponseDTO)object).setMsg((String)null);
        }

        baseResponseDTO.setData(object);
        baseResponseDTO.setPage(page);
        return baseResponseDTO;
    }

    public static BaseResponseDTO success(Object object) {
        BaseResponseDTO baseResponseDTO = new BaseResponseDTO();
        if (object instanceof BaseResponseDTO) {
            ((BaseResponseDTO)object).setCode((String)null);
            ((BaseResponseDTO)object).setMsg((String)null);
        }

        baseResponseDTO.setData(object);
        return baseResponseDTO;
    }

    public BaseResponseDTO(BaseErrorStatus errorStatus) {
        this.code = errorStatus.getErrCode();
        this.msg = errorStatus.getErrMsg();
    }

    public BaseResponseDTO(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return this.msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getBizSeqNo() {
        return this.bizSeqNo;
    }

    public void setBizSeqNo(String bizSeqNo) {
        this.bizSeqNo = bizSeqNo;
    }

    public PageInfo getPage() {
        return this.page;
    }

    public void setPage(PageInfo page) {
        this.page = page;
    }

    public Object getData() {
        return this.data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
